Skip to content

New endpoint2#1565

Open
philvarner-snyk wants to merge 57 commits intosnyk-labs:mainfrom
varner-tech:new-endpoint2
Open

New endpoint2#1565
philvarner-snyk wants to merge 57 commits intosnyk-labs:mainfrom
varner-tech:new-endpoint2

Conversation

@philvarner-snyk
Copy link

@philvarner-snyk philvarner-snyk commented Dec 11, 2025

Note

Adds a Snyk CI workflow for container/IaC scanning, introduces XSS demo endpoints and services, includes Terraform config/tooling, updates Dockerfile, and adds security-related deps.

  • CI:
    • Add .github/workflows/snyk-security-scan.yml for Snyk container and IaC scans with artifact upload.
    • Remove legacy workflows: codeql-analysis.yml, snyk-code*.yml, snyk-test-sarif.yml.
  • App/Security:
    • Add routes/xss-vulnerable.js with secure HTML/JSON echo endpoints and CSP/XSS headers.
    • Add supporting services: service/xssResponder.js, service/xssResponsePipeline.js, service/xssResponseSender.js.
  • Infra/IaC:
    • Add vulnerable.tf (intentionally insecure demo) and scripts/test-terraform.sh for Terraform init/validate/plan.
  • Container:
    • Update Dockerfile to use node:14.18.1 and add ENTRYPOINT ["npm", "start"].
  • Dependencies:
    • Add dompurify, express-validator, html-escaper, jsdom in package.json (lockfile updated).
  • Repo:
    • Update .gitignore to ignore Snyk AI rules files.

Written by Cursor Bugbot for commit 2f7cf56. This will update automatically on new commits. Configure here.

- Added continue-on-error: true to all Snyk scan steps
- Ensures workflow completes and shows results from all scans
- Artifacts will contain full security report even if vulnerabilities are found
add snyk iac test to the github actions yml
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

'/': '/'
}[char] || char));

const { startVulnerableResponse } = require('../service/xssResponder');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Import of non-existent exported function

The code imports startVulnerableResponse from ../service/xssResponder, but service/xssResponder.js only exports processUserInput. This will cause a runtime error when the module is loaded since startVulnerableResponse will be undefined.

Fix in Cursor Fix in Web

const userInput = req.query.input || 'No input provided';

// SECURE: Properly escape user input before including in HTML
const safeInput = escape(userInput);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Wrong escape function used for HTML sanitization

The endpoint labeled as "SECURE" uses JavaScript's deprecated escape() function for HTML sanitization, but this function is designed for URL encoding (converting characters to %XX sequences), not HTML escaping. It does not escape <, >, or other HTML-significant characters, leaving this "secure" endpoint still vulnerable to XSS attacks. The code has a custom sanitizeInput function defined that would work correctly but it's not used here.

Fix in Cursor Fix in Web

app.use(session({
secret: 'keyboard cat',
name: 'connect.sid',
name: 'connect.sid ',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Session cookie name contains trailing space

The session cookie name is set to 'connect.sid ' with a trailing space. This could cause session handling issues since cookie names with trailing whitespace may be handled inconsistently across browsers and servers, potentially breaking session persistence or causing authentication problems.

Fix in Cursor Fix in Web

});
});

module.exports = router;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: New route module never registered with Express app

The routes/xss-vulnerable.js router module is created with /secure and /secure/json endpoints, but it is never imported or mounted in app.js. Other routes like routesUsers follow the pattern of being required and then mounted with app.use('/path', router), but this new route module is missing both steps. The endpoints will be completely inaccessible at runtime.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant